package cn.centychen.example.spring.cloud.biz.a.service;

import org.springframework.stereotype.Component;

import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

/**
 * @author Cent.Chen
 * @Description Feign Client接口定义
 * @date 2019/8/2 10:45 AM
 */
@Slf4j
@Component
public class  RemoteServiceFallback  implements FallbackFactory<RemoteService> {

//	@Override
//    public String sayHello() {
//    	log.warn("RemoteServiceFallback Run....");
//    	return "fallback";
//    }

	@Override
	public RemoteService create(Throwable throwable) {
		//在这里创建Customer接口内的服务方法使用匿名内部类的方式
        return new RemoteService()
        {

			@Override
			public String sayHello() {
				log.warn("RemoteServiceFallback Run....",throwable);
		    	return "fallback";
			}
        };
	}
}
